Today's Integrated Development Environments (IDEs) and their associated editors frequently provide a number of tools that have multiple presentation modes. Many IDEs enable a developer to actually create code using visual designers (for example, WYSIWYG or “What You See is What You Get” designers) in additional to providing traditional text editing tools. Unfortunately, once a user is satisfied with the formatting of this source code, using some tools to modify or operate on the source code can result in loss of formatting.
For example, an IDE may have two distinct display modes in which the user may view and edit source code such as HTML (Hyper-Text Markup Language) documents: a source view in which the user can see and edit his HTML source code directly and a design view in which the user can see how the HTML may be rendered by a browser. This, of course, is a very useful feature since HTML documents are not rendered as typed. Instead special markup tags provide instructions to the browser with respect to how a section of HTML should be rendered on screen. In general, HTML is rendered in accordance with the markup tags, irrespective of placement of carriage returns, line feeds and other white space characters in the HTML document.
For example, the <p> markup tag instructs the browser to place text within a single paragraph that fits the width of the user's browser display on the page, followed by a line and the next paragraph. Thus:    <p>Hello</p><p>Goodbye</p>may be rendered thusly:
HelloGoodbye
Unfortunately, the design view experience can lead to code insertion and movement of markup in the saved HTML stream that is not the way the user may have meant it to be. Upon return to source view, this “extra” formatting such as carriage returns and other spacing may be lost.                For example, the HTML:        
<p>    Now is the time    For all good men    To come to the aid of their country.    </p>                might be rendered in a browser as follows:        
Now is the time For all good men To come to the aid oftheir country.
Suppose the user switched to design mode and while in design mode, changed “men” to “women”. When he returns to source mode, he is likely to find the following HTML:
<p>Now is the time For all good women To come to the aid of their country.</p>
Because the formatting of the HTML between the markup tags <p> and </p> is for the benefit of the HTML code developer, and has no effect on the browser, typically design modes do not preserve the formatting the user originally provided.
One could view the different display modes as black boxes which accept and save HTML text streams upon entering and leaving the black box. When the user is finished with one mode or black box, the resultant page can be saved as an HTML stream which can be then be loaded into the next mode or black box. It would be helpful if there were a way to restore the original format of the HTML stream (or other source code) whenever possible whenever automatic markup generation or modification has occurred.